#pragma once

#include "IBrushMonster.h"
#include "Common/Timer/TimerAxis.h"

class BrushTower : public IBrushMonster, public ITimerHandler
{
public:
	BrushTower();
	virtual ~BrushTower();
	///////////////////////////////  IBrushMonster  ///////////////////////////////////////////
	virtual int8_t GetBrushType() { return (int8_t)EDuplicateBrushType::EDuplicateBrushType_Tower; };
	virtual bool Init(IDuplicate *pDuplicate);
	virtual void UnInit();
	//获取总波数
	virtual int32_t MonsterWave() { return m_nWave; };
	virtual void StartBrush();
	virtual void StopBrush();
	//是否刷怪完成
	virtual bool FinishBrush();
	virtual void BrushUpdate();
	virtual void OnMonterDead(uint64_t monsCid, uint32_t monsId, uint32_t count, int32_t formationId, uint64_t killerCid);
	//脚本刷出的怪是否全部死亡
	virtual bool BrushMonsAllDie();
	/////////////////////////////// ITimerHandler ///////////////////////////////////////////
	virtual void OnTimer(uint32_t nTimerID);
private:
	int32_t GetTidByIdx(int32_t idx1, int32_t idx2);
	void GetIdxByTid(int32_t tid, int32_t &idx1, int32_t &idx2);
	void InitTimeBrush();
	void TimeBrush(int32_t nTimerID);
	void NotifyMonsWave();
	void CheckMonsEnterArea();
private:
	IDuplicate *m_pDuplicate;
	TowerBrushDataCfg *m_pBrush;
	bool m_bBrushFinish;
	bool m_bStart;
	int32_t m_nWave; //第几波怪
	uint64_t m_startWaveTime; //开始计时时间
	int32_t m_waveCd;		//当前波怪的cd,单位：秒
	SET_UINT64 m_setBrushMons;//脚本刷出来的怪
	int32_t m_tipIdx;		 //当前tip提示所在的索引
	SET_UINT64 m_setEnterAreaFight;
};